package com.soap.controller;


import com.soap.entity.dto.PersonDto;
import com.soap.entity.po.Person;
import com.soap.entity.query.UserQuery;
import com.soap.service.PersonService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZhangPY
 * @since 2020-06-07
 */
@RestController
@RequestMapping("/person")
public class PersonController {


    @Autowired
    private PersonService personService;


    @ApiOperation(value = "分页查询Person")
    @RequestMapping(value = "/getPersonListByPage" , method = RequestMethod.POST)
    public String getPersonListByPage(HttpServletRequest request, PersonDto personDto) {
        return personService.getPersonListByPage(personDto);
    }

    @ApiOperation(value = "不分页查询Person")
    @RequestMapping(value = "/getPersonListForExport" , method = RequestMethod.POST)
    public String getPersonListForExport(@RequestBody PersonDto personDto) {
        return personService.getPersonListForExport(personDto);
    }

    @ApiOperation(value = "通过id查询Person")
    @RequestMapping(value = "/getPersonById" , method = RequestMethod.GET)
    public String getPersonById(Long personId) {
        return personService.getPersonById(personId);
    }

    @ApiOperation(value = "测试add")
    @RequestMapping(value = "/testAdd" , method = RequestMethod.POST)
    public String testAdd(HttpServletRequest request, @RequestBody Person personDto) {
        return personService.testAdd(personDto);
    }
}
